<?php 


class WeiboBPO {

	private static $instance = null;

	
	public static function instance(){
		if(self::$instance == null)
			self::$instance =  new WeiboBPO;
		return self::$instance;
	}
	
	/**
	 * 同步微博的用户资料到用户信息表。
	 * @param UserProvidor $up
	 * @param User $user
	 */
	public function sync($up,$user){
		
		$clent = WeiboApiFactory::client($up->pid,$up->aKey,$up->sKey);
			
		$pu = $clent->show_user($up->puid);
		
		$user->name = $pu['name'];
		$user->city = $pu['location'];
		$user->desc = $pu['description'];
		$user->gender = $pu['gender'];
		$user->save();
	}
	
	/**
	 * 
	 * @param UserProvidor $up
	 * @param $userId
	 * @param string $password
	 */
	public function registerWellMsg(UserProvidor $up,$userId,$password){
		$clent = WeiboApiFactory::client($up->pid,$up->aKey,$up->sKey);
		
		
		return $clent->update("欢迎加入【名人吧】！您可为自己定制专有的域名，展示您风采！ http://mr8.me");
		
	}
}
 ?>
